package com.systemdevelopment.mainproject.View.Admin;

import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXTextField;
import com.systemdevelopment.mainproject.Model.BorrowRecord;
import com.systemdevelopment.mainproject.Model.Record;
import com.systemdevelopment.mainproject.View.NormalUser.PersonalRecordController;
import com.systemdevelopment.mainproject.View.mainUI;
import javafx.beans.property.SimpleStringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.collections.ObservableSet;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.control.cell.TextFieldTableCell;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;

public class RecordController extends PersonalRecordController {

    @FXML
    private TableColumn<Record, String> isReturned;

    @FXML
    private JFXButton searchButton;

    @FXML
    private TableColumn<Record, String> ISBN;

    @FXML
    private JFXTextField searchField;

    @FXML
    private TableColumn<Record, String> BookName;

    @FXML
    private TableColumn<Record, String> borrower;

    @FXML
    private TableColumn<Record, String> startTime;

    @FXML
    private TableColumn<Record, String> endTime;

    @FXML
    private JFXButton showAllButton;

    @FXML
    private TableView<Record> table;

    @FXML
    private TableColumn<Record, String> returnTime;

    private ObservableList<Record> recordSet;

    private ObservableList<Record> tableItems;
    @FXML
    void showAll(ActionEvent event) {

    }

    @FXML
    void search(ActionEvent event) {

    }
    public void InitTable()
    {
        InitColumn();
        try {
            ArrayList<Record> records= BorrowRecord.getAllRecord();
            recordSet= FXCollections.observableList(records);
            tableItems=FXCollections.observableList(records);
            table.setItems(tableItems);

        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}
